<HTML><HEAD><TITLE>tent_get(?X, -TV)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(tentative)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>tent_get(?X, -TV)</H1>
Get X's tentative value
<DL>
<DT><EM>X</EM></DT>
<DD>Any term, typically a variable
</DD>
<DT><EM>TV</EM></DT>
<DD>Will be bound to a (nonvar) term
</DD>
</DL>
<H2>Description</H2>

    	Get a variable's (or a whole term's) tentative value, i.e. create a
	term TV that represents the current tentative value of X. 
	<UL>
    	<LI>If X is a tentative variable, TV is bound to the tentative value.</LI>
	<LI>If X is a variable without tentative value, an error is raised.</LI>
    	<LI>If X is atomic, its tentative value is the same as X.</LI>
	<LI>If X is a compound term, TV will be bound to a corresponding compound
	term with all variables replaced by their tentative values. The resulting
	term TV will be a proper instance of X.</LI>
	</UL>
    
<H3>Modes and Determinism</H3><UL>
<LI>tent_get(?, -) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(tentative_value_not_set) </EM>
<DD>X (or a subterm of X) has no tentative value
</DL>
<H2>Examples</H2>
<PRE>
    ?- tent_set(X, 27), tent_get(X, TV).
    X = X{27 -&gt; 0}
    TV = 27
    Yes (0.00s cpu)

    ?- tent_set(X, 27), tent_set(X, 99), tent_get(X, TV).
    X = X{99 -&gt; 0}
    TV = 99
    Yes (0.00s cpu)

    ?- X = foo(Y), tent_set(X, foo(27)), X tent_get TV.
    X = foo(Y{27 -&gt; 0})
    Y = Y{27 -&gt; 0}
    TV = foo(27)
    Yes (0.00s cpu)

    ?- tent_get(27, TV).
    TV = 27
    Yes (0.00s cpu)

    ?- tent_get(X, TV).
    uncaught exception in exit_block(tentative_value_not_set)
    Abort

    ?- tent_get(foo(X), TV).
    uncaught exception in exit_block(tentative_value_not_set)
    Abort
    </PRE>
<H2>See Also</H2>
<A HREF="../../lib/tentative/tent_set-2.html">tent_set / 2</A>, <A HREF="../../lib/tentative/has_tent_value-1.html">has_tent_value / 1</A>, <A HREF="../../lib/tentative/tent_fix-1.html">tent_fix / 1</A>
</BODY></HTML>
